import Vue from 'vue'
import Vuex from 'vuex'
import { getItem, setItem } from '@/utils/auth'

Vue.use(Vuex)
const token = 'HEIMA-TOUTIAO'

export default new Vuex.Store({
  state: {
    user: getItem(token)
  },
  mutations: {
    initUser (state, data) {
      state.user = data
      setItem(token, data)
    }
  },
  actions: {
  },
  modules: {
  }
})
